package dj.engine.panel;

import java.awt.Color;
import java.awt.Graphics2D;

import dj.engine.events.EventReceiver;
import dj.engine.util.Vec2f;
import dj.engine.util.Vec2i;

public abstract class Panel extends EventReceiver {
	protected Vec2f dimensions;
	protected Vec2f position;
	protected Color background;
	protected Panel(Vec2f dimensions, Vec2f position)
	{
		this.dimensions = dimensions;
		this.position = position;
	}
	
	protected float getWidth()
	{
		return dimensions.x;
	}
	protected float getHeight()
	{
		return dimensions.y;
	
	}
	
	public void setPosition(Vec2f pos)
	{
		position = pos;
	}
	
	protected float getX()
	{
		return position.x;
	}
	
	protected float getY()
	{
		return position.y;
	}
	
	void setBackground(Color c)
	{
		background = c;
	}
	
	@Override
	public void onDraw(Graphics2D g)
	{
		Color curr = g.getColor();
		g.setColor(Color.black);
		g.drawRect((int)position.x, (int)position.y, (int)dimensions.x, (int)dimensions.y);
		g.setColor(curr);
	}
	
	@Override
	public void onResize(Vec2i dimensions)
	{
		this.dimensions = new Vec2f(dimensions.x, dimensions.y);
	}
	
}
